<?php
declare (strict_types = 1);

namespace app\command;

use app\mall\model\ActivityLog;
use app\mall\model\GoodsComment;
use app\order\model\Order;
use app\order\model\OrderGoods;
use app\order\model\OrderInfo;
use app\user\model\User;
use app\user\model\UserShareOrder;
use think\console\Command;
use think\console\Input;
use think\console\input\Argument;
use think\console\input\Option;
use think\console\Output;
use think\facade\Log;

use app\common\self\MyJob;

class Dele extends Command
{
    public $data;

    protected function configure()
    {
        // 指令配置
        $this->setName('dele')
            ->addArgument('orn')
            ->setDescription('快速删除关联订单值');
    }

    protected function execute(Input $input, Output $output)
    {

        $b = MyJob::pushQueue('TeamSettlementJob',[122123312,3333333,132231231217]);
        var_dump('------结束------------');
        exit;


        $orn =  $input->getArgument('orn');
        if(!$orn){
            $orn = '';
        }
        var_dump(12222);
        $orderModel = new Order();
        $orderList = $orderModel->where([['id','>',15]])->select();

        foreach($orderList as $item){
            OrderInfo::where('oid',$item->id)->delete();
            OrderGoods::where('order_id',$item->id)->delete();
            OrderInfo::where('oid',$item->id)->delete();
            ActivityLog::where('oid',$item->id)->delete();
            UserShareOrder::where('oid',$item->id)->delete();
        }

        //$order = Order::where('order_sn',$orn)->find();

        $output->writeln('11111');



    	// 指令输出
        $data = [
            'openid' => 'o68MO5MvmaEPlV6pASKNXliedBXY',
            'out_trade_no' => '200720102643873853650',
        ];



    	$output->writeln('--------模型调用结束---------------');
    }
}
